package com.sfy.auth.common.enums;

import lombok.Getter;

/**
 * @Author: sfy
 * @Date: 2024/4/12 16:16
 * @Description: 逻辑删除的枚举类型
 */
@Getter
public enum IsDeletedFlagEnum {
    DELETED(1, "已删除"),
    UN_DELETED(0, "未删除");

    private int code;

    private String desc;

    IsDeletedFlagEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static IsDeletedFlagEnum getByCode(int codeVal) {
        for (IsDeletedFlagEnum isDeletedFlagEnum : IsDeletedFlagEnum.values()) {
            if (isDeletedFlagEnum.code == codeVal) {
                return isDeletedFlagEnum;
            }
        }
        return null;
    }
}
